package com.example.app.handle.order.impl;

import com.example.app.handle.order.OrderConfirmChainHandle;
import com.example.app.pojo.dto.OrderCreateDto;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;

@Component
public class OrderCreateParamNotNullChainHandler implements OrderConfirmChainHandle<OrderCreateDto> {
    @Override
    public void handler(OrderCreateDto dto) {
        if (StringUtils.isBlank(dto.getMemberId())){
            throw new RuntimeException("会员ID不能为空");
        }
        if (StringUtils.isBlank(dto.getProductNo())){
            throw new RuntimeException("产品编号不能为空");
        }
        if (StringUtils.isBlank(dto.getOrderNo())){
            throw new RuntimeException("订单编号不能为空");
        }
    }

    @Override
    public int getOrder() {
        return 0;
    }
}
